package cn.tanglong.demo;

import cn.tanglong.mq.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer01 {
    //队列名称
    public static final String QUEUE = "helloworld123";

    public static void main(String[] args) throws Exception {
            //获取连接
            Connection connection = ConnectionUtil.getConnection();
            //创建与Exchange的通道，
            Channel channel = connection.createChannel();

            // 创建队列 名称 持久化 使用后是否删除 独占 额外的参数
            channel.queueDeclare(QUEUE, true, false, false, null);
            String message = "芜湖" + System.currentTimeMillis();

            // 选择操作的对象和是否有routingkey
            channel.basicPublish("", QUEUE, null, message.getBytes());
            System.out.println("111111111");
    }
}
